<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>
    <div id="app">
        <div style="margin-top: 100px">
            <a @click.prevent="alert()" href="https://cn.vuejs.org">阻止跳转</a>
        </div>
    </div>

<!--引入vue文件-->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
    const vm = Vue.createApp({
        methods: {
            alert: function(){
                alert('阻止<a>标签的链接')
            }
        }
    }).mount('#app');
</script>

</body>
</html>
